﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IronLua.Metadata
{
    public struct UpValue
    {
        internal UpValue(bool inStack, uint index, string name)
        {
            this.InStack = inStack;
            this.Index = index;
            this.Name = name;
        }

        internal UpValue(bool inStack, uint index)
            : this(true, index, string.Empty)
        {
            
        }

        public readonly uint    Index;
        public readonly bool    InStack;
        public readonly string  Name;        

        public override string ToString()
        {
            return "{0} (upvalue {1} {2})".FormatWith(this.Name, this.Index, this.InStack ? "in stack" : "");
        }

    }
}
